<template>
  <div style="overflow: auto">
    <div class="container">
      <el-table :data="surveys">
        <el-table-column label="编号" prop="DSSV_No"></el-table-column>
        <el-table-column label="姓名" prop="DSSV_Name"></el-table-column>
        <el-table-column label="村组" prop="DSSV_Village"></el-table-column>
        <el-table-column width="200" label="勘察信息">
          <template slot-scope="scope">
            <span>
              <template v-if="scope.row.DSSV_IsInfoDone!=1">
                <el-tag v-if="scope.row.DSSV_InfoUser==0 || scope.row.DSSV_InfoUser==-1" type='danger'>未提交</el-tag>
                <el-tag v-else>已提交</el-tag>
              </template>
              
              <el-tag v-if="scope.row.DSSV_IsInfoDone==-1" type='danger'>未审核</el-tag>
              <el-tag  v-else :type=" scope.row.DSSV_IsInfoDone?'':'danger'">{{ scope.row.DSSV_IsInfoDone?'审核通过':'审核不通过' }}</el-tag>
            </span>
          </template>
        </el-table-column>

        <el-table-column width="200" label="户型图">
          <template slot-scope="scope">
            <span>
              <template v-if="scope.row.DSSV_IsPlaneDone!=1">
                <el-tag v-if="scope.row.DSSV_PlaneUser==0 || scope.row.DSSV_PlaneUser==-1" type='danger'>未提交</el-tag>
                <el-tag v-else>已提交</el-tag>
              </template>
              
              <el-tag v-if="scope.row.DSSV_IsPlaneDone==-1" type='danger'>未审核</el-tag>
              <el-tag  v-else :type=" scope.row.DSSV_IsPlaneDone?'':'danger'">{{ scope.row.DSSV_IsPlaneDone?'审核通过':'审核不通过' }}</el-tag>
            </span>
          </template>
        </el-table-column>

       <el-table-column width="200" label="勘察记录">
          <template slot-scope="scope">
            <span>
              <template v-if="scope.row.DSSV_IsSurveyDone!=1">
                <el-tag v-if="scope.row.DSSV_SurveyUser==0 || scope.row.DSSV_SurveyUser==-1" type='danger'>未提交</el-tag>
                <el-tag v-else>已提交</el-tag>
              </template>
              
              <el-tag v-if="scope.row.DSSV_IsSurveyDone==-1" type='danger'>未审核</el-tag>
              <el-tag  v-else :type=" scope.row.DSSV_IsSurveyDone?'':'danger'">{{ scope.row.DSSV_IsSurveyDone?'审核通过':'审核不通过' }}</el-tag>
            </span>
          </template>
        </el-table-column>

        <el-table-column width="180" label="操作">
          <template slot-scope="scope">
            <el-button type="primary" icon="el-icon-edit" circle @click="toDetailPage(scope.row)"></el-button>
            
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { getUnCommitSurvey } from '@/api/project/survey.js'
export default {
  components: {},
  computed: {
    ...mapGetters({
      curEmp: 'user/curEmp',
    }),
  },
  data: function () {
    return {
      surveys: [],
      surveyStep: {
        0: '首勘',
        1: '复勘',
        2: '二次复勘',
      },
    }
  },
  methods: {
    getUnCommitSurvey() {
      getUnCommitSurvey().then(({ data }) => {
        this.surveys = data
      })
    },
    toSurveyAudit(id) {
      this.GetSurveyAudits(id)
    },
    toDetailPage(row) {
      this.$router.push({
        path: 'userSurveyDetail',
        query: { id: row.DSSV_ID, prjId: row.DSSV_ProjectID },
      })
    },
  },
  mounted: function () {
    this.getUnCommitSurvey()
  },
}
</script>

<style scoped>
.header {
  padding: 20px;
}

.container {
  padding: 20px 10px;
}

.upload {
  margin-right: 15px;
}
</style>
